home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
try_qb
/
whereis.bas
(
.txt
)
< prev
Wrap
QuickBASIC Tokenized Source
|
1989-12-04
|
4KB
|
71 lines
EOFTYPE
FILETYPE
DIRTYPE
ScanDir3
PathSpec
Level
FileSpec
MakeFileName
GetEntry
FileNum
EntryType
RightCh
EntryLine
TestCh
EntryName
EntryExt
TempSpec
DirEntry
NewPath
Declare symbolic constants used in program:
File to look for
Enter the directory where the search should start"
(optional drive + directories). Press <ENTER> to begin
the search in the root directory of the current drive.
Starting directory
Make the top level call (level 1) to begin the search:
Delete all temporary files createde
by the program.
Search complete.
ScanDir
= SCANDIR
This procedure recursively scans a directory for the=
file name entered by the user.n
NOTE: The SUB header doesn't use the STATIC keyword
since this procedure needs a new set of variables
each time it is invoked.d
Now searching"
Make a file specification for the temporary file:
Get a directory listing of the current directory, and
save it in the temporary file:
Get the next available file number:
Open the DIR listing file and scan it:
Process the file, one line at a time:
Get an entry from the DIR listing:m
If entry is a file:
If the FileSpec$ string matches, print entry and,
exit this loop:
If the entry is a directory, then make a recursive
call to ScanDir with the new directory:
Now searching"
Scan on this DIR listing file is finished, so close it:
MakeFileName
= MAKEFILENAME$
This procedure makes a file name from a root string
("TWH" - defined as a symbolic constant at the module
level) and a number passed to it as an argument (Num).
GetEntry
= GETENTRY
This procedure processes entry lines in a DIR listing
saved to a file.r
Loop until a valid entry or end-of-file (EOF) is read:=
Get first character from the line for test:
Entry or EOF found, decide which:
Not EOF, either a file or a directory.:
Build and return the entry name:d
Test for extension and add to name if there is one:
Determine the entry type, and return that
value to the point where GetEntry$ was called:
Directory
Filec